package com.mashuai.utils.toolkit.core.msController;

import com.mashuai.utils.toolkit.core.msFile.MsFileUtils;
import com.mashuai.utils.toolkit.core.msFile.dto.MsAnalysisZipFileDataDto;
import com.mashuai.utils.toolkit.core.msFile.dto.MsDownloadFileDto;
import com.mashuai.utils.toolkit.core.msFile.dto.MsDownloadFileZipDto;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * @ClassName: MsExcelController
 * @Description:
 */
@RequestMapping("${ms.http.file.head:/ms/file}")
@RestController
public class MsFileController {

    @PostMapping("${ms.http.file.download.file:/downloadFile}")
    public void downloadFile(HttpServletResponse response, @RequestBody MsDownloadFileDto dto) throws Exception {
        MsFileUtils.downloadFile(response, dto);
    }

    @PostMapping("${ms.http.file.download.file-zip:/downloadFileZip}")
    public void downloadFileZip(HttpServletResponse response, @RequestBody MsDownloadFileZipDto dto) throws Exception {
        MsFileUtils.downloadFileZip(response, dto);
    }

    @PostMapping("${ms.http.file.analysis.zip-json:/analysisZipFileData}")
    public Map<String,Object> analysisZipFileData(@RequestBody MsAnalysisZipFileDataDto dto) throws Exception {
       return MsFileUtils.analysisZipFileData( dto);
    }

}
